home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 22 / Cream of the Crop 22.iso / program / eflibpt4.zip / DEMO / DATATYPE / SIMPEXP.PAS < prev    next >
Pascal/Delphi Source File  |  1996-08-18  |  2KB  |  47 lines

  1. { Borland Pascal Extended Function Library - EFLIB (C) Johan Larsson, 1996
  2.   Demonstration; stream importing and exporting of data type contents
  3.  
  4.   EFLIB IS PROTECTED BY THE COPYRIGHT LAW AND MAY NOT BE COPIED, SOLD OR
  5.   MANIPULATED. FOR MORE INFORMATION, SEE PROGRAM MANUAL! THIS DEMONSTRAT-
  6.   ION PROGRAM MAY FREELY BE USED AND DISTRIBUTED.                          }
  7.  
  8.  
  9. uses EFLIBDEF, EFLIBDAT, EFLIBIO;
  10.  
  11.  
  12. var Text   : TextObjectType;
  13.     Stream : FileStreamObjectType;
  14.     Index  : word;
  15.  
  16. begin
  17.      Stream.Initialize ('RESOURCE.$$$', 1024); Stream.Create; { Create }
  18.  
  19.      with Text do begin
  20.           Initialize;
  21.           AddText ('Borland Pascal with Objects 7.0 offers many new features,');
  22.           AddText ('including:');
  23.           AddText ('');
  24.           AddText ('o DOS protected-mode applications - Create DOS applications');
  25.           AddText ('  that run in protected mode and gain access to all available');
  26.           AddText ('  extended memory (up to 16 MB).');
  27.           WriteLn ('* Exported text to a stream *');
  28.           StreamExport (@Stream);
  29.           Intercept;
  30.      end;
  31.  
  32.      { Go to first position in stream before reading }
  33.      Stream.Seek (0);
  34.  
  35.      with Text do begin
  36.           Initialize;
  37.           StreamImport (@Stream, 6);
  38.           WriteLn ('* Imported text from a stream *');
  39.           for Index := 1 to Elements do WriteLn ('':2, Text(Index));
  40.           Intercept;
  41.      end;
  42.  
  43.      Stream.Intercept;
  44.  
  45.      if DeleteFile ('RESOURCE.$$$') then WriteLn ('* Done *');
  46.      if GlobalDataError then WriteLn ('Error(s) reported!');
  47. end.